﻿using Hotel.BLL;
using Hotel.Model.Admin;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Hotel.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AdminController : ControllerBase
    {
        AdminBLL bll;
        public AdminController(AdminBLL bll)
        {
            this.bll = bll;
        }

        /// <summary>
        /// 管理员登录
        /// </summary>
        /// <param name="username">帐号</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetAdminLogin(string username, string pwd)
        {
            try
            {
                T_Admin info = bll.GetAdminLogin(username, pwd);
                return Ok(new
                {
                    data = info,
                });
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
